﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FourKillEnginePrototype
{
    public class Player
    {
        public double Height { get; set; }
        public double Width { get; set; }
        public double LocationX { get; set; }
        public double LocationY { get; set; }
        public double Levitation { get; set; }
        public double OrientationAngle { get; set; }

        public double CameraHeight { get { return Levitation + Height; } }

        public void Move(double distance)
        {
            LocationX += distance * Math.Cos(OrientationAngle);
            LocationY += distance * Math.Sin(OrientationAngle);
        }

        public void Levitate(double distance)
        {
            if (CameraHeight + distance >= 1)
            {
                Levitation += distance;
            }
        }

        public void SideStep(double distance)
        {

            if (distance < 0)
            {
                LocationX += distance * Math.Cos(OrientationAngle + (Math.PI * 1.5));
                LocationY += distance * Math.Sin(OrientationAngle + (Math.PI * 1.5));
            }
            else if (distance > 0)
            {
                LocationX += distance * Math.Cos(OrientationAngle - (Math.PI / 2));
                LocationY += distance * Math.Sin(OrientationAngle - (Math.PI / 2));
            }
        }

        public void TurnDegrees(double degrees)
        {
            OrientationAngle += degrees * Math.PI / 180;
        }
    }
}
